import 'package:flutter/material.dart';
import 'package:huajianshe_app/common/res.dart';
import 'package:huajianshe_app/widget/RoundedCornerWidget.dart';

import 'package:huajianshe_app/widget/SimpleScrollView.dart';
import 'package:huajianshe_app/widget/appbar/CAppBar.dart';

import 'model/CircleModel.dart';

//我和Ta共同的圈子
class JointCirclesPage extends StatelessWidget {

  final List<CircleInfo>? circles;

  const JointCirclesPage({Key? key, this.circles}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: CAppBar(bgColor: Colors.white, title: '共同圈子',),
      body: SimpleScrollView(children: [
        H(10),
        Row(children: [
          VD(18.0, width: 3, color: C.primary,),
          W(13),
          Text('共同的', style: TS(15, C.gray333)),
        ]),
        H(12),
        buildCircles(),
        H(16),

      ]),
    );
  }

  Widget buildCircles() {
    if (circles?.isNotEmpty == true) {
      return Padding(padding: EdgeInsets.symmetric(horizontal: 13),
          child: Wrap(spacing: 10, runSpacing: 10, children: [
            ...circles!.map((e) {
              return RoundedCornerWidget(child: Text('#${e.title}', style: TS(14, C.gray0D0E15),), height: 32, radius: 16, borderWidth: 0, backgroundColor: C.grayF6,
                padding: EdgeInsets.symmetric(horizontal: 12, vertical: 6),);
            })
          ])
      );
    }
    return H(0);
  }
}